<?php
namespace app\admin\controller;

use think\Controller;
use think\Loader;
use think\Session;
use think\Request;
use think\Url;
use think\Config;
use think\Cache;
use auth\AuthMenu;
use auth\Auth;
use app\admin\model\Brand;

/**
 * 后台controller基础类
 * @author aierui github  https://github.com/Aierui
 *
 * @version 1.0
 */
class Test extends Controller
{
    public function index()
    {
        $auth = new Auth();
        $group = $auth->getGroups(session('userInfo.id'));
        $groupid = $group[0]['group_id'];
        $menuGroup = 'menu_'.$groupid;

        p(Cache::clear());
        //echo url('/admin/auth/group/index');

    }
    public function test()
    {
        $info = array(
            '操作系统'=>PHP_OS,
            '运行环境'=>$_SERVER["SERVER_SOFTWARE"],
            '主机名'=>$_SERVER['SERVER_NAME'],
            'WEB服务端口'=>$_SERVER['SERVER_PORT'],
            '网站文档目录'=>$_SERVER["DOCUMENT_ROOT"],
            '浏览器信息'=>substr($_SERVER['HTTP_USER_AGENT'], 0, 40),
            '通信协议'=>$_SERVER['SERVER_PROTOCOL'],
            '请求方法'=>$_SERVER['REQUEST_METHOD'],
            'ThinkPHP版本'=>THINK_VERSION,
            '上传附件限制'=>ini_get('upload_max_filesize'),
            '执行时间限制'=>ini_get('max_execution_time').'秒',
            '服务器时间'=>date("Y年n月j日 H:i:s"),
            '北京时间'=>gmdate("Y年n月j日 H:i:s",time()+8*3600),
            '服务器域名/IP'=>$_SERVER['SERVER_NAME'].' [ '.gethostbyname($_SERVER['SERVER_NAME']).' ]',
            '用户的IP地址'=>$_SERVER['REMOTE_ADDR'],
            '剩余空间'=>round((disk_free_space(".")/(1024*1024)),2).'M',
        );
        p($info);
    }

    public function test2(){
        $auth = new AuthMenu();
        p($auth ->getMenuList((session('userInfo.id'))));
    }

    /**
     * 获取活动日期
     * @return [type] [description]
     */
    public function getBrand()
    {
        $brand = new Brand();
        $brands = $brand->getBrand();
        p($brands);
    }
}

